package javacommon.util;

import java.sql.Connection;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

/*
 * 
 */
public class InitDataServlet extends HttpServlet {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3195193902024648349L;

	public void init() throws ServletException {
		super.init();
		try
		{	
			ConnectionManager cm=new ConnectionManager();
			Connection conn=cm.dbConnect();
			String sql = "select paraId,paraName,paraCode,paraValue,paraType from parameters where paraType="+1;
			List<Map<String,Object>> list = cm.doQuery(conn, sql);
			for (Map<String, Object> map : list) {
				System.setProperty(map.get("paraCode")+"", map.get("paraValue")+"");
			}
			cm.closeConnection(conn);
		} catch (Exception e)
		{			
			e.printStackTrace();
		}
	}
}
